From 8d4f4d5fdeec1b6d68d01d6d6bc4c4c3576b3e97 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 22 Feb 2004 01:07:39 +0000 Subject: [PATCH] Don't crash if item is NULL. (#131542, Dan Damian) Sun Feb 22 02:10:34 2004 Matthias Clasen * gtk/gtkentrycompletion.c (gtk_entry_completion_default_completion_func): Don't crash if item is NULL. (#131542, Dan Damian) --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtkentrycompletion.c | 21 ++++++++++++--------- 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90e2cb9b7e..c294eb8248 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Feb 22 02:10:34 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_default_completion_func): + Don't crash if item is NULL. (#131542, Dan Damian) + Sun Feb 22 02:04:03 2004 Matthias Clasen * configure.in: Add a check for a new enough fontconfig, since diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 90e2cb9b7e..c294eb8248 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Sun Feb 22 02:10:34 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_default_completion_func): + Don't crash if item is NULL. (#131542, Dan Damian) + Sun Feb 22 02:04:03 2004 Matthias Clasen * configure.in: Add a check for a new enough fontconfig, since diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 90e2cb9b7e..c294eb8248 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Sun Feb 22 02:10:34 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_default_completion_func): + Don't crash if item is NULL. (#131542, Dan Damian) + Sun Feb 22 02:04:03 2004 Matthias Clasen * configure.in: Add a check for a new enough fontconfig, since diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 90e2cb9b7e..c294eb8248 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Sun Feb 22 02:10:34 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_default_completion_func): + Don't crash if item is NULL. (#131542, Dan Damian) + Sun Feb 22 02:04:03 2004 Matthias Clasen * configure.in: Add a check for a new enough fontconfig, since diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 90e2cb9b7e..c294eb8248 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Sun Feb 22 02:10:34 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_default_completion_func): + Don't crash if item is NULL. (#131542, Dan Damian) + Sun Feb 22 02:04:03 2004 Matthias Clasen * configure.in: Add a check for a new enough fontconfig, since diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index da969f8f07..a4bf298111 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -507,15 +507,18 @@ gtk_entry_completion_default_completion_func (GtkEntryCompletion *completion, completion->priv->text_column, &item, -1); - normalized_string = g_utf8_normalize (item, -1, G_NORMALIZE_ALL); - case_normalized_string = g_utf8_casefold (normalized_string, -1); - - if (!strncmp (key, case_normalized_string, strlen (key))) - ret = TRUE; - - g_free (item); - g_free (normalized_string); - g_free (case_normalized_string); + if (item != NULL) + { + normalized_string = g_utf8_normalize (item, -1, G_NORMALIZE_ALL); + case_normalized_string = g_utf8_casefold (normalized_string, -1); + + if (!strncmp (key, case_normalized_string, strlen (key))) + ret = TRUE; + + g_free (item); + g_free (normalized_string); + g_free (case_normalized_string); + } return ret; } -- 2.30.2